package com.example.wordssample.ViewModel;

import android.app.Application;

import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;

import com.example.wordssample.Entity.Word;
import com.example.wordssample.Repositry.WordRepository;

import java.util.List;

public class WordViewModel  extends AndroidViewModel {
    private WordRepository mRepository;

    private LiveData<List<Word>> mAllWords;

    public WordViewModel (Application application) {
        super(application);

        mRepository = new WordRepository(application);
        mAllWords = mRepository.getAllWords();
    }
    public void deleteWord(Word word) {
        mRepository.deleteWord(word);}
   public LiveData<List<Word>> getmAllWord() {
        return mAllWords;
    }

    public void insert(Word word) {
        mRepository.insert(word); }



    public void deleteAll() {
        mRepository.deleteAll();
    }


}

